import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
const devConfig = loadEnv("development", "./");
import path from "path";

// https://vitejs.dev/config/
export default defineConfig({
  // base: "/visitorMobile/", // todo 视情况启用
  plugins: [vue()],
  server: {
    proxy: {
      "/api": {
        target: devConfig.VITE_API_URL,
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
    },
  },
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "src"),
    },
  },
});
